import {
  RECEIVE_SEARCH_LIST,
  RECORD_USER_INFO,
  RECEIVE_LOGOUT,
  RECEIVE_USERINFO,
  RECEIVE_POSITION,
  RECEIVE_CATEGORY,
  RECEIVE_SHOPS
} from './mutaitions-type.js'

export default {
  [RECEIVE_SEARCH_LIST] (state, { searchList }) {
    state.searchList = searchList
  },
  [RECORD_USER_INFO] (state, { userInfo }) {
    // state.userInfo = JSON.stringify(localStorage.setItem('userInfo', userInfo))
    state.userInfo = userInfo
  },
  [RECEIVE_USERINFO] (state, { userInfo }) {
    state.userInfo = userInfo
  },
  [RECEIVE_LOGOUT] (state) {
    state.userInfo = {}
  },
  [RECEIVE_POSITION] (state, { address }) {
    state.address = address
  },
  [RECEIVE_CATEGORY] (state, { categoryList }) {
    state.categoryList = categoryList
  },
  [RECEIVE_SHOPS] (state, { shopsList }) {
    state.shopsList = shopsList
  }
}
